// 初始样式表

import './App.css'

import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { Route, BrowserRouter as Router, Routes } from 'react-router-dom'
import store, { persistor } from '@/store/index.ts'

import { PersistGate } from 'redux-persist/integration/react'
import { Provider } from 'react-redux'
import ReactDOM from 'react-dom/client'
import RouteManager from '@/components/RouteManager.tsx'
import RouterProgress from '@/components/RouterProgress.tsx'

// react-query

// 路由

// redux数据持久化

// 状态管理redux

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: 5,
      retryDelay: 700
    }
  }
})

ReactDOM.createRoot(document.getElementById('root')!).render(
  <QueryClientProvider client={queryClient}>
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <Router>
          {/* 切换路由显示进度条 */}
          <RouterProgress></RouterProgress>
          <Routes>
            <Route path="*" element={<RouteManager />} />
          </Routes>
        </Router>
      </PersistGate>
    </Provider>
  </QueryClientProvider>
)
